package cn.llssit.project.wechatapi.controller;

import cn.llssit.project.wechatapi.mapper.CustomerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author: Lesan
 * @Date: 2020-06-05
 */
@Controller
@RequestMapping("/wechatapi")
public class CustomerController {
    @Autowired
    private CustomerMapper customerMapper;

    @GetMapping("/initCustomer")
    public ResponseEntity<Object> initCustomer(String nickName, String city, Integer gender, String avatarUrl, String phone) {
        customerMapper.initInsert(nickName, city, gender, avatarUrl,phone);
        return new ResponseEntity<>(HttpStatus.OK);
    }

    @GetMapping("/userExists")
    public ResponseEntity<Object> userExists(String phone){
        return new ResponseEntity<>(customerMapper.existsOne(phone), HttpStatus.OK);
    }
}
